"""
演示文件的追加写入
"""

# 打开文件，不存在的文件
f = open("D:/python-learn/test.txt", "a", encoding="UTF-8")
# write写入
f.write("Hello world！")
# flush刷新
f.flush()
# close关闭
f.close()

# 打开一个存在的文件
f = open("D:/python-learn/test.txt", "a", encoding="UTF-8")
# write写入、flush刷新
f.write("\nHello Python！")
# close关闭
f.close()